import request from '@/libs/request'

const baseOrganizationApiPath = '/admin/organization/'
export const getList = () => {
  return request({
    url: baseOrganizationApiPath + 'treeGrid'
  })
}

export const tree = () => {
  return request({
    url: baseOrganizationApiPath + 'tree',
    method: 'post'
  })
}

export const organizationAll = (params) => {
  return request({
    url: baseOrganizationApiPath + 'all',
    params
  })
}

export const editOrganization = (data) => {
  return request({
    url: baseOrganizationApiPath + 'edit',
    method: 'post',
    data: request.obj2FormData(data)
  })
}

export const addOrganization = (data) => {
  return request({
    url: baseOrganizationApiPath + 'add',
    method: 'put',
    data: request.obj2FormData(data)
  })
}

export const delOrganization = (params) => {
  return request({
    url: baseOrganizationApiPath + 'delete',
    method: 'delete',
    params
  })
}
